 var req;

        function callback()
        {
                if(req.readyState == 4)
                {
                   if(req.status == 200) {
                                if(req.responseXML != null) {
                                        //get info from server
                                        //alert(req.responseText);
                                        var items = [];
                                        var b1 = req.responseXML.getElementsByTagName('Buddyname');
                                        //get select box
                                        var selectbox = document.getElementById('friends');
                                        selectbox.length = b1.length;

                                        //set the values                                                                                       
                                        for(var i=0; i< b1.length; i++) {
                                                var tempname = b1.item(i).firstChild.nodeValue;
                                                selectbox.options[i] = new Option(tempname, tempname);
                                        }
                                }
                        }
                        else
                                { //alert(req.status);
                                }
        }
        else
        { //alert(req.readyState);
        }
        }


        function loadXMLDoc(url_var) {
           if(window.XMLHttpRequest)
        {
                try{
                        req = new XMLHttpRequest();
                                //alert ("Creating new XMLHttpRequest");
                }
                catch(e)
                {
                req = false;
                }
        }
        else if(window.ActiveXObject)
        {
                try{
                        req = new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch(e)
                {
                try{
                       req = new ActiveXObject("Microsoft.XMLHTTP");
               }
               catch(e)
               {
                       req = false;
               }
                }
        }
         if(req){
                req.open("GET", url_var, true);
        req.onreadystatechange = callback;
        req.send("");
        }
        }



        var url = "http://silo.cs.indiana.edu:13795/servlet/FriendsServlet?nym=home";
        loadXMLDoc(url);



